<?php
/**
  *@function 得到所有的分类信息
  *
  *@date 2013-05-29 20:17
  *
  */
class M_search extends CI_Model {

    function __construct()
    {
        parent::__construct();
		$this->load->database();
    }
    
    /**
     * 将搜索结果插入到数据库
     */
    public function insertSearch($search_content ,$search_number)
    {
    	$data = array('user_id'=>$this->session->userdata('user_id')?$this->session->userdata('user_id'):'0',
    			'search_content'=>$search_content,
    			'search_time'=>time(),
    			'search_refer'=>@$_SERVER['HTTP_REFERER']?$_SERVER['HTTP_REFERER']:'',
    			'search_number'=>$search_number
    			
    	);
    	
    	if($this->db->insert('zy_search',$data)) return true;
    }

    public function selectSearch($page,$pageSize)
    {
      return $this->db->get('zy_search',$pageSize,$page)->result();
    }
}